import {request,upload} from './index';


const env = process.env.config[process.env.NODE_ENV];
/*----------公共接口--------------*/

/**
 * 上传文件
 * @returns {Promise<*>|*}
 * @param file
 * @param formData
 */
export const FileUpload = (file,formData = {}) => {
  return upload({
    url: '/api/v1/file/FileUpload',
    file,
    formData,
  })
}

/**
 * 手机号登录
 * @param data
 * @returns {Promise<*>|*}
 */
export const phoneLogin = (data) => {
  return request({
    url: '/api/v1/login/login',
    method: 'POST',
    data,
  })
}

/**
 * 微信登录
 * @param data
 * @returns {Promise<*>|*}
 */
export const wxLogin = (data) => {
  return request({
    url: '/api/v1/login/wxLogin',
    method: 'GET',
    data,
  })
}

/**
 * 获取sid
 * @param data
 * @returns {Promise<*>|*}
 */
export const findSid = (data) => {
  return request({
    url: '/api/v1/login/findSid',
    method: 'GET',
    data,
  })
}

/**
 * 获取用户信息
 * @param data
 * @returns {Promise<*>|*}
 */
export const getUserInfo = (data) => {
  return request({
    url: '/api/v1/user/getUserInfo',
    method: 'POST',
    data,
  })
}
/*----------个人中心接口--------------*/
/**
 * 个人中心
 * @param data
 * @returns {Promise<*>|*}
 */
export const personalCenter = (data) => {
  return request({
    url: '/api/v1/user/personalCenter',
    method: 'POST',
    data,
  })
}
/**
 * 修改用户头像
 * @param data
 * @returns {Promise<*>}
 */
export const editAvatar = (data) => {
  return request({
    url: '/api/v1/user/editAvatar',
    method: 'POST',
    data,
  })
}

/**
 * 修改用户昵称
 * @param data
 * @returns {Promise<*>}
 */
export const editNickname = (data) => {
  return request({
    url: '/api/v1/user/editNickname',
    method: 'POST',
    data,
  })
}

/**
 * 修改用户签名
 * @param data
 * @returns {Promise<*>}
 */
export const editSignature = (data) => {
  return request({
    url: '/api/v1/user/editSignature',
    method: 'POST',
    data,
  })
}
/*----------通讯录好友接口--------------*/
/**
 * 获取好友列表
 * @param data
 * @returns {Promise<*>|*}
 */
export const getFriendList = (data) => {
  return request({
    url: '/api/v1/friend/getFriendList',
    method: 'POST',
    data,
  })
}

/**
 * 查找好友
 * @param data
 * @returns {Promise<*>|*}
 */
export const findFriend = (data) => {
  return request({
    url: '/api/v1/friend/findFriend',
    method: 'POST',
    data,
  })
}

/**
 * 添加好友
 * @param data
 * @returns {Promise<*>|*}
 */
export const addFriend = (data) => {
  return request({
    url: '/api/v1/friend/addFriend',
    method: 'POST',
    data,
  })
}

/**
 * 好友申请列表
 * @param data
 * @returns {Promise<*>|*}
 */
export const friendNoticeList = (data) => {
  return request({
    url: '/api/v1/friend/friendNoticeList',
    method: 'POST',
    data,
  })
}

/**
 * 同意好友
 * @param data
 * @returns {Promise<*>|*}
 */
export const agreeFriend = (data) => {
  return request({
    url: '/api/v1/friend/agreeFriend',
    method: 'POST',
    data,
  })
}

/**
 * 好友通知消息
 * @param data
 * @returns {Promise<*>|*}
 */
export const friendNoticeMsg = (data) => {
  return request({
    url: '/api/v1/friend/friendNoticeMsg',
    method: 'POST',
    data,
  })
}

/**
 * 好友信息
 * @param data
 * @returns {Promise<*>|*}
 */
export const friendData = (data) => {
  return request({
    url: '/api/v1/friend/friendData',
    method: 'POST',
    data,
  })
}

/**
 * 拉黑/取消拉黑好友
 * @param data
 * @returns {Promise<*>|*}
 */
export const friendBlackList = (data) => {
  return request({
    url: '/api/v1/friend/friendBlackList',
    method: 'POST',
    data,
  })
}
/*----------聊天部分接口--------------*/
/**
 * 聊天列表
 * @param data
 * @returns {Promise<*>|*}
 */
export const chatHomeList = (data) => {
  return request({
    url: '/api/v1/chat/chatHomeList',
    method: 'POST',
    data,
  })
}

/**
 * 聊天记录
 * @param data
 * @returns {Promise<*>|*}
 */
export const chatRecordList = (data) => {
  return request({
    url: '/api/v1/chat/chatRecordList',
    method: 'POST',
    data,
  })
}

/**
 * 未读聊天记录
 * @param data
 * @returns {Promise<*>|*}
 */
export const unreadChatRecord = (data) => {
  return request({
    url: '/api/v1/chat/unreadChatRecord',
    method: 'POST',
    data,
  })
}

/**
 * 删除聊天消息
 * @param data
 * @returns {Promise<*>|*}
 */
export const deleteChatMessage = (data) => {
  return request({
    url: '/api/v1/chat/deleteChatMessage',
    method: 'POST',
    data,
  })
}

/**
 * 删除聊天
 * @param data
 * @returns {Promise<*>|*}
 */
export const deleteChat = (data) => {
  return request({
    url: '/api/v1/chat/deleteChat',
    method: 'POST',
    data,
  })
}
